(function (_super) {
    var EVENT_CLICK = Laya.Event.CLICK;

    function Help() {
        Help.super(this);

        this.movie = null;
        this.btnPrev = null;
        this.btnNext = null;
        this.btnSkip = null;
        this.btnStart = null;
        this.index = 1;

        this.init();
    }
    Laya.class(Help, "Alert.Help", _super);
    var _proto = Help.prototype;
    _proto.destroy = function () {
        _super.prototype.destroy.call(this, true);

        this.movie = null;
        this.btnPrev = null;
        this.btnNext = null;
        this.btnSkip = null;
        this.btnStart = null;
    }
    _proto.createButton = function (name) {
        var x = 0, y = 0;
        switch(name){
            case "prev":
                x = 50, y = 540;
                break;
            case "next":
            case "start":
                x = 500, y = 540;
                break;
            case "skip":
                x = 650, y = -50;
                break;
        }
        var btn = new Laya.Button("res/alert/help/btn_" + name + ".png", "");
            btn.stateNum = 1;
            btn.pos(x, y);

        return btn;
    }
    _proto.prev = function () {
        this.btnNext.visible = true;
        this.btnStart.visible = false;

        this.index --;
        if(this.index <= 1){
            this.index = 1;
            this.btnPrev.visible = false;
        }
        this.movie.play("help" + this.index, true);
    }
    _proto.next = function () {
        this.btnPrev.visible = true;
        this.btnStart.visible = false;

        this.index ++;
        if(this.index >= 3){
            this.index = 3;
            this.btnNext.visible = false;
            this.btnStart.visible = true;
        }
        this.movie.play("help" + this.index, true);
    }
    _proto.init = function () {
        this.size(800, 600);

        var movie = utils.createSkeleton("res/alert/help/help_bg");
            movie.pos(400, 300);
            movie.play("help1", true);

        var btnPrev = this.createButton("prev");
            btnPrev.visible = false;
            btnPrev.on(EVENT_CLICK, this, this.prev);

        var btnNext = this.createButton("next");
            btnNext.on(EVENT_CLICK, this, this.next);

        var btnSkip = this.createButton("skip");
            btnSkip.on(EVENT_CLICK, this, this.destroy);

        var btnStart = this.createButton("start");
            btnStart.on(EVENT_CLICK, this, this.destroy);
            btnStart.visible = false;

        this.movie = movie;
        this.btnPrev = btnPrev;
        this.btnNext = btnNext;
        this.btnSkip = btnSkip;
        this.btnStart = btnStart;
        this.addChildren(movie, btnPrev, btnNext, btnSkip, btnStart);
    }
})(Laya.Sprite);